<template>
  <div class="dashboard-container">
    <div class="app-container">
      <!-- 自定义组件，标题 -->
      <PageTitle :show-before="true">
        <template v-slot:before>
          <h2>简历下载</h2>
        </template>
      </PageTitle>
      <el-row type="flex" justify="end" style="margin-top: 20px;">
        <el-col :span="4">
          <el-select placeholder="公司ID" v-model="list.keyType" @change="handleKeyTypeChange" clearable>
            <el-option
              v-for="item in positionName"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="6">
          <el-row :gutter="10" type="flex">
            <el-input placeholder="请输入搜索内容" @keyup.enter.native="handleSearch" v-model="list.keyword"></el-input>
            <el-button type="primary" @click="handleSearch">
              <i class="el-icon-search"></i>
            </el-button>
          </el-row>
        </el-col>
      </el-row>
      <!-- 数据表 -->
      <el-table
        v-loading="downloadLoading"
        ooltip-effect="dark"
        border
        :data="selResumeDownLists"
        max-height="500px"
        style="margin-top: 20px"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
          label="姓名"
          align="center"
          width="width"
          prop="fullname"
          fixed
        >
          <!-- <template slot-scope="scope">
            <el-link :href="scope.row.resumeLink" type="primary">{{
              scope.row.fullname
            }}</el-link>
          </template> -->
        </el-table-column>
        <el-table-column label="基本信息" align="center" prop="" fixed>
          <template slot-scope="scope">
            {{ scope.row.age }} / {{ scope.row.sexCn }} /
            {{ scope.row.educationCn }} / {{ scope.row.experienceCn }}
          </template>
        </el-table-column>
        <el-table-column
          label="企业名称"
          align="center"
          prop="companyName"
          width="width"
          fixed
        >
          <!-- <template slot-scope="scope">
            <el-link type="primary" :href="scope.row.companyLink">{{
              scope.row.companyName
            }}</el-link>
          </template> -->
        </el-table-column>
        <el-table-column
          label="下载时间"
          align="center"
          prop="enterJobTime"
          width="width"
        >
          <template slot-scope="scope">
            <div>
              <i class="el-icon-time"></i>
              {{ scope.row.enterJobTime | dateFormat }}
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-row :gutter="10" style="margin-top: 10px">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          style="text-align: right"
        >
        </el-pagination>
      </el-row>
    </div>
  </div>
</template>

<script>
import { selResumeDownListApi } from "@/api/client";
export default {
  data() {
    return {
      downloadLoading: false,
      selResumeDownLists: [],
      list: {
        page: 1,
        pageSize: 10,
        keyType: "",
        keyword: "",
      },
      positionName: [
        { value: 1, label: "公司ID" },
        { value: 2, label: "企业会员UID" },
        { value: 3, label: "简历ID" },
        { value: 4, label: "个人会员ID" },
      ],
    };
  },
  created() {
    this.selResumeDownList();
  },
  methods: {
    // 选择页码的时候
    handleSizeChange(pageSize) {
      console.log(pageSize);
      this.list.pageSize = pageSize;
      this.selResumeDownList();
    },
    // 选择当前页码的时候
    handleCurrentChange(page) {
      console.log(page);
      this.list.page = page;
      this.selResumeDownList();
    },
    // 列表查询
    async selResumeDownList() {
      const res = await selResumeDownListApi(this.list);
      console.log(res);
      this.selResumeDownLists = res.records;
      this.total = res.total;
    },
    // 下拉改变时候
    handleKeyTypeChange(val) {
      console.log(val);
      this.list.page = 1;
      this.selResumeDownList();
    },
    // 搜索
    handleSearch() {
      this.selResumeDownList();
    }
  },
};
</script>

<style scoped></style>
